package com.winit.openapi.ups.controller;

import javax.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

import com.alibaba.fastjson.JSON;
import com.winit.common.spi.context.CommandContext;
import com.winit.openapi.controller.BaseController;
import com.winit.openapi.model.RequestMsg;
import com.winit.openapi.model.ResponseMsg;
import com.winit.ups.spi.sys.WirelessHandheldOperationService;
import com.winit.ups.spi.sys.command.QueryWirelessHandheldOperationByWarehouseIdCommand;
import com.winit.ups.spi.sys.vo.WirelessHandheldOperationVo;

/**
 * 扫描枪版本信息
 * @author qibin.tang
 *
 */
@Controller
@RequestMapping(value = "/ups/wirelessHandheldOperation")
public class UpsWirelessHandheldOperationController extends BaseController{
    
    private Logger  logger = LoggerFactory.getLogger(UpsWirelessHandheldOperationController.class);
    
    @Resource
    private WirelessHandheldOperationService wirelessHandheldOperationService;
    
    
    @RequestMapping(value = "/queryByWarehouseId")
    public String queryWarehouseWhitelist(@ModelAttribute RequestMsg requestMsg, @ModelAttribute ResponseMsg responseMsg) {
    	QueryWirelessHandheldOperationByWarehouseIdCommand command = JSON.parseObject(requestMsg.getData().toString(), QueryWirelessHandheldOperationByWarehouseIdCommand.class);
        command.setCtx(CommandContext.getContext());
        WirelessHandheldOperationVo vo = wirelessHandheldOperationService.queryWirelessHandheldOperationByWarehouseId(command);
        logger.info("UpsWirelessHandheldOperationController.queryWarehouseWhitelist:"+JSON.toJSONString(vo));
        responseMsg.setData(vo);
        return SUCCESS;
    }
    
    

}
